

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="Description" content="scikit-learn: machine learning in Python">

  
  <title>sklearn.pipeline.Pipeline &mdash; scikit-learn 0.22 documentation</title>
  
  <link rel="canonical" href="http://scikit-learn.org/stable/modules/generated/sklearn.pipeline.Pipeline.html" />

  
  <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  <link rel="stylesheet" href="../../_static/css/vendor/bootstrap.min.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/gallery.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script> 
</head>
<body>
<nav id="navbar" class="sk-docs-navbar navbar navbar-expand-md navbar-light bg-light py-0">
  <div class="container-fluid sk-docs-container px-0">
      <a class="navbar-brand py-0" href="../../index.html">
        <img
          class="sk-brand-img"
          src="../../_static/scikit-learn-logo-small.png"
          alt="logo"/>
      </a>
    <button
      id="sk-navbar-toggler"
      class="navbar-toggler"
      type="button"
      data-toggle="collapse"
      data-target="#navbarSupportedContent"
      aria-controls="navbarSupportedContent"
      aria-expanded="false"
      aria-label="Toggle navigation"
    >
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="sk-navbar-collapse collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../../install.html">Install</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../../user_guide.html">User Guide</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../classes.html">API</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../../auto_examples/index.html">Examples</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../getting_started.html">Getting Started</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../tutorial/index.html">Tutorial</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../glossary.html">Glossary</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../developers/index.html">Development</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../faq.html">FAQ</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../related_projects.html">Related packages</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../roadmap.html">Roadmap</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../about.html">About us</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="https://github.com/scikit-learn/scikit-learn">GitHub</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="https://scikit-learn.org/dev/versions.html">Other Versions</a>
        </li>
        <li class="nav-item dropdown nav-more-item-dropdown">
          <a class="sk-nav-link nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">More</a>
          <div class="dropdown-menu" aria-labelledby="navbarDropdown">
              <a class="sk-nav-dropdown-item dropdown-item" href="../../getting_started.html">Getting Started</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../tutorial/index.html">Tutorial</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../glossary.html">Glossary</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../developers/index.html">Development</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../faq.html">FAQ</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../related_projects.html">Related packages</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../roadmap.html">Roadmap</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../about.html">About us</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="https://github.com/scikit-learn/scikit-learn">GitHub</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="https://scikit-learn.org/dev/versions.html">Other Versions</a>
          </div>
        </li>
      </ul>
      <div id="searchbox" role="search">
          <div class="searchformwrapper">
          <form class="search" action="../../search.html" method="get">
            <input class="sk-search-text-input" type="text" name="q" aria-labelledby="searchlabel" />
            <input class="sk-search-text-btn" type="submit" value="Go" />
          </form>
          </div>
      </div>
    </div>
  </div>
</nav>
<div class="d-flex" id="sk-doc-wrapper">
    <input type="checkbox" name="sk-toggle-checkbox" id="sk-toggle-checkbox">
    <label id="sk-sidemenu-toggle" class="sk-btn-toggle-toc btn sk-btn-primary" for="sk-toggle-checkbox">Toggle Menu</label>
    <div id="sk-sidebar-wrapper" class="border-right">
      <div class="sk-sidebar-toc-wrapper">
        <div class="sk-sidebar-toc-logo">
          <a href="../../index.html">
            <img
              class="sk-brand-img"
              src="../../_static/scikit-learn-logo-small.png"
              alt="logo"/>
          </a>
        </div>
        <div class="btn-group w-100 mb-2" role="group" aria-label="rellinks">
            <a href="sklearn.pipeline.FeatureUnion.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="sklearn.pipeline.FeatureUnion">Prev</a><a href="../classes.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="API Reference">Up</a>
            <a href="sklearn.pipeline.make_pipeline.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="sklearn.pipeline.make_pipeline">Next</a>
        </div>
        <div class="alert alert-danger p-1 mb-2" role="alert">
          <p class="text-center mb-0">
          <strong>scikit-learn 0.22</strong><br/>
          <a href="http://scikit-learn.org/dev/versions.html">Other versions</a>
          </p>
        </div>
        <div class="alert alert-warning p-1 mb-2" role="alert">
          <p class="text-center mb-0">
            Please <a class="font-weight-bold" href="../../about.html#citing-scikit-learn"><string>cite us</string></a> if you use the software.
          </p>
        </div>
          <div class="sk-sidebar-toc">
            <ul>
<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sklearn.pipeline</span></code>.Pipeline</a><ul>
<li><a class="reference internal" href="#examples-using-sklearn-pipeline-pipeline">Examples using <code class="docutils literal notranslate"><span class="pre">sklearn.pipeline.Pipeline</span></code></a></li>
</ul>
</li>
</ul>

          </div>
      </div>
    </div>
    <div id="sk-page-content-wrapper">
      <div class="sk-page-content container-fluid body px-md-3" role="main">
        
  <div class="section" id="sklearn-pipeline-pipeline">
<h1><a class="reference internal" href="../classes.html#module-sklearn.pipeline" title="sklearn.pipeline"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sklearn.pipeline</span></code></a>.Pipeline<a class="headerlink" href="#sklearn-pipeline-pipeline" title="Permalink to this headline">¶</a></h1>
<dl class="class">
<dt id="sklearn.pipeline.Pipeline">
<em class="property">class </em><code class="sig-prename descclassname">sklearn.pipeline.</code><code class="sig-name descname">Pipeline</code><span class="sig-paren">(</span><em class="sig-param">steps</em>, <em class="sig-param">memory=None</em>, <em class="sig-param">verbose=False</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/pipeline.py#L30"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.pipeline.Pipeline" title="Permalink to this definition">¶</a></dt>
<dd><p>Pipeline of transforms with a final estimator.</p>
<p>Sequentially apply a list of transforms and a final estimator.
Intermediate steps of the pipeline must be ‘transforms’, that is, they
must implement fit and transform methods.
The final estimator only needs to implement fit.
The transformers in the pipeline can be cached using <code class="docutils literal notranslate"><span class="pre">memory</span></code> argument.</p>
<p>The purpose of the pipeline is to assemble several steps that can be
cross-validated together while setting different parameters.
For this, it enables setting parameters of the various steps using their
names and the parameter name separated by a ‘__’, as in the example below.
A step’s estimator may be replaced entirely by setting the parameter
with its name to another estimator, or a transformer removed by setting
it to ‘passthrough’ or <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
<p>Read more in the <a class="reference internal" href="../compose.html#pipeline"><span class="std std-ref">User Guide</span></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>steps</strong><span class="classifier">list</span></dt><dd><p>List of (name, transform) tuples (implementing fit/transform) that are
chained, in the order in which they are chained, with the last object
an estimator.</p>
</dd>
<dt><strong>memory</strong><span class="classifier">None, str or object with the joblib.Memory interface, optional</span></dt><dd><p>Used to cache the fitted transformers of the pipeline. By default,
no caching is performed. If a string is given, it is the path to
the caching directory. Enabling caching triggers a clone of
the transformers before fitting. Therefore, the transformer
instance given to the pipeline cannot be inspected
directly. Use the attribute <code class="docutils literal notranslate"><span class="pre">named_steps</span></code> or <code class="docutils literal notranslate"><span class="pre">steps</span></code> to
inspect estimators within the pipeline. Caching the
transformers is advantageous when fitting is time consuming.</p>
</dd>
<dt><strong>verbose</strong><span class="classifier">bool, default=False</span></dt><dd><p>If True, the time elapsed while fitting each step will be printed as it
is completed.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Attributes</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>named_steps</strong><span class="classifier">bunch object, a dictionary with attribute access</span></dt><dd><p>Read-only attribute to access any step parameter by user given name.
Keys are step names and values are steps parameters.</p>
</dd>
</dl>
</dd>
</dl>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="sklearn.pipeline.make_pipeline.html#sklearn.pipeline.make_pipeline" title="sklearn.pipeline.make_pipeline"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sklearn.pipeline.make_pipeline</span></code></a></dt><dd><p>Convenience function for simplified pipeline construction.</p>
</dd>
</dl>
</div>
<p class="rubric">Examples</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sklearn</span> <span class="kn">import</span> <span class="n">svm</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sklearn.datasets</span> <span class="kn">import</span> <span class="n">make_classification</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sklearn.feature_selection</span> <span class="kn">import</span> <span class="n">SelectKBest</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sklearn.feature_selection</span> <span class="kn">import</span> <span class="n">f_regression</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sklearn.pipeline</span> <span class="kn">import</span> <span class="n">Pipeline</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c1"># generate some data to play with</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">X</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">make_classification</span><span class="p">(</span>
<span class="gp">... </span>    <span class="n">n_informative</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">n_redundant</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">random_state</span><span class="o">=</span><span class="mi">42</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c1"># ANOVA SVM-C</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">anova_filter</span> <span class="o">=</span> <span class="n">SelectKBest</span><span class="p">(</span><span class="n">f_regression</span><span class="p">,</span> <span class="n">k</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">clf</span> <span class="o">=</span> <span class="n">svm</span><span class="o">.</span><span class="n">SVC</span><span class="p">(</span><span class="n">kernel</span><span class="o">=</span><span class="s1">&#39;linear&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">anova_svm</span> <span class="o">=</span> <span class="n">Pipeline</span><span class="p">([(</span><span class="s1">&#39;anova&#39;</span><span class="p">,</span> <span class="n">anova_filter</span><span class="p">),</span> <span class="p">(</span><span class="s1">&#39;svc&#39;</span><span class="p">,</span> <span class="n">clf</span><span class="p">)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c1"># You can set the parameters using the names issued</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c1"># For instance, fit using a k of 10 in the SelectKBest</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c1"># and a parameter &#39;C&#39; of the svm</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">anova_svm</span><span class="o">.</span><span class="n">set_params</span><span class="p">(</span><span class="n">anova__k</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="n">svc__C</span><span class="o">=.</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">X</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
<span class="go">Pipeline(steps=[(&#39;anova&#39;, SelectKBest(...)), (&#39;svc&#39;, SVC(...))])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">prediction</span> <span class="o">=</span> <span class="n">anova_svm</span><span class="o">.</span><span class="n">predict</span><span class="p">(</span><span class="n">X</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">anova_svm</span><span class="o">.</span><span class="n">score</span><span class="p">(</span><span class="n">X</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
<span class="go">0.83</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c1"># getting the selected features chosen by anova_filter</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">anova_svm</span><span class="p">[</span><span class="s1">&#39;anova&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get_support</span><span class="p">()</span>
<span class="go">array([False, False,  True,  True, False, False,  True,  True, False,</span>
<span class="go">       True, False,  True,  True, False,  True, False,  True,  True,</span>
<span class="go">       False, False])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c1"># Another way to get selected features chosen by anova_filter</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">anova_svm</span><span class="o">.</span><span class="n">named_steps</span><span class="o">.</span><span class="n">anova</span><span class="o">.</span><span class="n">get_support</span><span class="p">()</span>
<span class="go">array([False, False,  True,  True, False, False,  True,  True, False,</span>
<span class="go">       True, False,  True,  True, False,  True, False,  True,  True,</span>
<span class="go">       False, False])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c1"># Indexing can also be used to extract a sub-pipeline.</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">sub_pipeline</span> <span class="o">=</span> <span class="n">anova_svm</span><span class="p">[:</span><span class="mi">1</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">sub_pipeline</span>
<span class="go">Pipeline(steps=[(&#39;anova&#39;, SelectKBest(...))])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">coef</span> <span class="o">=</span> <span class="n">anova_svm</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">coef_</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">anova_svm</span><span class="p">[</span><span class="s1">&#39;svc&#39;</span><span class="p">]</span> <span class="ow">is</span> <span class="n">anova_svm</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">coef</span><span class="o">.</span><span class="n">shape</span>
<span class="go">(1, 10)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">sub_pipeline</span><span class="o">.</span><span class="n">inverse_transform</span><span class="p">(</span><span class="n">coef</span><span class="p">)</span><span class="o">.</span><span class="n">shape</span>
<span class="go">(1, 20)</span>
</pre></div>
</div>
<p class="rubric">Methods</p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.pipeline.Pipeline.decision_function" title="sklearn.pipeline.Pipeline.decision_function"><code class="xref py py-obj docutils literal notranslate"><span class="pre">decision_function</span></code></a>(self, X)</p></td>
<td><p>Apply transforms, and decision_function of the final estimator</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#sklearn.pipeline.Pipeline.fit" title="sklearn.pipeline.Pipeline.fit"><code class="xref py py-obj docutils literal notranslate"><span class="pre">fit</span></code></a>(self, X[, y])</p></td>
<td><p>Fit the model</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.pipeline.Pipeline.fit_predict" title="sklearn.pipeline.Pipeline.fit_predict"><code class="xref py py-obj docutils literal notranslate"><span class="pre">fit_predict</span></code></a>(self, X[, y])</p></td>
<td><p>Applies fit_predict of last step in pipeline after transforms.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#sklearn.pipeline.Pipeline.fit_transform" title="sklearn.pipeline.Pipeline.fit_transform"><code class="xref py py-obj docutils literal notranslate"><span class="pre">fit_transform</span></code></a>(self, X[, y])</p></td>
<td><p>Fit the model and transform with the final estimator</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.pipeline.Pipeline.get_params" title="sklearn.pipeline.Pipeline.get_params"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_params</span></code></a>(self[, deep])</p></td>
<td><p>Get parameters for this estimator.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#sklearn.pipeline.Pipeline.predict" title="sklearn.pipeline.Pipeline.predict"><code class="xref py py-obj docutils literal notranslate"><span class="pre">predict</span></code></a>(self, X, \*\*predict_params)</p></td>
<td><p>Apply transforms to the data, and predict with the final estimator</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.pipeline.Pipeline.predict_log_proba" title="sklearn.pipeline.Pipeline.predict_log_proba"><code class="xref py py-obj docutils literal notranslate"><span class="pre">predict_log_proba</span></code></a>(self, X)</p></td>
<td><p>Apply transforms, and predict_log_proba of the final estimator</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#sklearn.pipeline.Pipeline.predict_proba" title="sklearn.pipeline.Pipeline.predict_proba"><code class="xref py py-obj docutils literal notranslate"><span class="pre">predict_proba</span></code></a>(self, X)</p></td>
<td><p>Apply transforms, and predict_proba of the final estimator</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.pipeline.Pipeline.score" title="sklearn.pipeline.Pipeline.score"><code class="xref py py-obj docutils literal notranslate"><span class="pre">score</span></code></a>(self, X[, y, sample_weight])</p></td>
<td><p>Apply transforms, and score with the final estimator</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#sklearn.pipeline.Pipeline.score_samples" title="sklearn.pipeline.Pipeline.score_samples"><code class="xref py py-obj docutils literal notranslate"><span class="pre">score_samples</span></code></a>(self, X)</p></td>
<td><p>Apply transforms, and score_samples of the final estimator.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.pipeline.Pipeline.set_params" title="sklearn.pipeline.Pipeline.set_params"><code class="xref py py-obj docutils literal notranslate"><span class="pre">set_params</span></code></a>(self, \*\*kwargs)</p></td>
<td><p>Set the parameters of this estimator.</p></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="sklearn.pipeline.Pipeline.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">steps</em>, <em class="sig-param">memory=None</em>, <em class="sig-param">verbose=False</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/pipeline.py#L130"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.pipeline.Pipeline.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize self.  See help(type(self)) for accurate signature.</p>
</dd></dl>

<dl class="method">
<dt id="sklearn.pipeline.Pipeline.decision_function">
<code class="sig-name descname">decision_function</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/utils/metaestimators.py#L472"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.pipeline.Pipeline.decision_function" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply transforms, and decision_function of the final estimator</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">iterable</span></dt><dd><p>Data to predict on. Must fulfill input requirements of first step
of the pipeline.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>y_score</strong><span class="classifier">array-like of shape (n_samples, n_classes)</span></dt><dd></dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.pipeline.Pipeline.fit">
<code class="sig-name descname">fit</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em>, <em class="sig-param">y=None</em>, <em class="sig-param">**fit_params</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/pipeline.py#L322"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.pipeline.Pipeline.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>Fit the model</p>
<p>Fit all the transforms one after the other and transform the
data, then fit the transformed data using the final estimator.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">iterable</span></dt><dd><p>Training data. Must fulfill input requirements of first step of the
pipeline.</p>
</dd>
<dt><strong>y</strong><span class="classifier">iterable, default=None</span></dt><dd><p>Training targets. Must fulfill label requirements for all steps of
the pipeline.</p>
</dd>
<dt><strong>**fit_params</strong><span class="classifier">dict of string -&gt; object</span></dt><dd><p>Parameters passed to the <code class="docutils literal notranslate"><span class="pre">fit</span></code> method of each step, where
each parameter name is prefixed such that parameter <code class="docutils literal notranslate"><span class="pre">p</span></code> for step
<code class="docutils literal notranslate"><span class="pre">s</span></code> has key <code class="docutils literal notranslate"><span class="pre">s__p</span></code>.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>self</strong><span class="classifier">Pipeline</span></dt><dd><p>This estimator</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.pipeline.Pipeline.fit_predict">
<code class="sig-name descname">fit_predict</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em>, <em class="sig-param">y=None</em>, <em class="sig-param">**fit_params</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/utils/metaestimators.py#L420"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.pipeline.Pipeline.fit_predict" title="Permalink to this definition">¶</a></dt>
<dd><p>Applies fit_predict of last step in pipeline after transforms.</p>
<p>Applies fit_transforms of a pipeline to the data, followed by the
fit_predict method of the final estimator in the pipeline. Valid
only if the final estimator implements fit_predict.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">iterable</span></dt><dd><p>Training data. Must fulfill input requirements of first step of
the pipeline.</p>
</dd>
<dt><strong>y</strong><span class="classifier">iterable, default=None</span></dt><dd><p>Training targets. Must fulfill label requirements for all steps
of the pipeline.</p>
</dd>
<dt><strong>**fit_params</strong><span class="classifier">dict of string -&gt; object</span></dt><dd><p>Parameters passed to the <code class="docutils literal notranslate"><span class="pre">fit</span></code> method of each step, where
each parameter name is prefixed such that parameter <code class="docutils literal notranslate"><span class="pre">p</span></code> for step
<code class="docutils literal notranslate"><span class="pre">s</span></code> has key <code class="docutils literal notranslate"><span class="pre">s__p</span></code>.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>y_pred</strong><span class="classifier">array-like</span></dt><dd></dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.pipeline.Pipeline.fit_transform">
<code class="sig-name descname">fit_transform</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em>, <em class="sig-param">y=None</em>, <em class="sig-param">**fit_params</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/pipeline.py#L355"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.pipeline.Pipeline.fit_transform" title="Permalink to this definition">¶</a></dt>
<dd><p>Fit the model and transform with the final estimator</p>
<p>Fits all the transforms one after the other and transforms the
data, then uses fit_transform on transformed data with the final
estimator.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">iterable</span></dt><dd><p>Training data. Must fulfill input requirements of first step of the
pipeline.</p>
</dd>
<dt><strong>y</strong><span class="classifier">iterable, default=None</span></dt><dd><p>Training targets. Must fulfill label requirements for all steps of
the pipeline.</p>
</dd>
<dt><strong>**fit_params</strong><span class="classifier">dict of string -&gt; object</span></dt><dd><p>Parameters passed to the <code class="docutils literal notranslate"><span class="pre">fit</span></code> method of each step, where
each parameter name is prefixed such that parameter <code class="docutils literal notranslate"><span class="pre">p</span></code> for step
<code class="docutils literal notranslate"><span class="pre">s</span></code> has key <code class="docutils literal notranslate"><span class="pre">s__p</span></code>.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>Xt</strong><span class="classifier">array-like of shape  (n_samples, n_transformed_features)</span></dt><dd><p>Transformed samples</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.pipeline.Pipeline.get_params">
<code class="sig-name descname">get_params</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">deep=True</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/pipeline.py#L136"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.pipeline.Pipeline.get_params" title="Permalink to this definition">¶</a></dt>
<dd><p>Get parameters for this estimator.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>deep</strong><span class="classifier">boolean, optional</span></dt><dd><p>If True, will return the parameters for this estimator and
contained subobjects that are estimators.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>params</strong><span class="classifier">mapping of string to any</span></dt><dd><p>Parameter names mapped to their values.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.pipeline.Pipeline.inverse_transform">
<em class="property">property </em><code class="sig-name descname">inverse_transform</code><a class="headerlink" href="#sklearn.pipeline.Pipeline.inverse_transform" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply inverse transformations in reverse order</p>
<p>All estimators in the pipeline must support <code class="docutils literal notranslate"><span class="pre">inverse_transform</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>Xt</strong><span class="classifier">array-like of shape  (n_samples, n_transformed_features)</span></dt><dd><p>Data samples, where <code class="docutils literal notranslate"><span class="pre">n_samples</span></code> is the number of samples and
<code class="docutils literal notranslate"><span class="pre">n_features</span></code> is the number of features. Must fulfill
input requirements of last step of pipeline’s
<code class="docutils literal notranslate"><span class="pre">inverse_transform</span></code> method.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>Xt</strong><span class="classifier">array-like of shape (n_samples, n_features)</span></dt><dd></dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.pipeline.Pipeline.predict">
<code class="sig-name descname">predict</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em>, <em class="sig-param">**predict_params</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/utils/metaestimators.py#L393"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.pipeline.Pipeline.predict" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply transforms to the data, and predict with the final estimator</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">iterable</span></dt><dd><p>Data to predict on. Must fulfill input requirements of first step
of the pipeline.</p>
</dd>
<dt><strong>**predict_params</strong><span class="classifier">dict of string -&gt; object</span></dt><dd><p>Parameters to the <code class="docutils literal notranslate"><span class="pre">predict</span></code> called at the end of all
transformations in the pipeline. Note that while this may be
used to return uncertainties from some models with return_std
or return_cov, uncertainties that are generated by the
transformations in the pipeline are not propagated to the
final estimator.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>y_pred</strong><span class="classifier">array-like</span></dt><dd></dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.pipeline.Pipeline.predict_log_proba">
<code class="sig-name descname">predict_log_proba</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/utils/metaestimators.py#L510"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.pipeline.Pipeline.predict_log_proba" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply transforms, and predict_log_proba of the final estimator</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">iterable</span></dt><dd><p>Data to predict on. Must fulfill input requirements of first step
of the pipeline.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>y_score</strong><span class="classifier">array-like of shape (n_samples, n_classes)</span></dt><dd></dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.pipeline.Pipeline.predict_proba">
<code class="sig-name descname">predict_proba</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/utils/metaestimators.py#L453"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.pipeline.Pipeline.predict_proba" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply transforms, and predict_proba of the final estimator</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">iterable</span></dt><dd><p>Data to predict on. Must fulfill input requirements of first step
of the pipeline.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>y_proba</strong><span class="classifier">array-like of shape (n_samples, n_classes)</span></dt><dd></dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.pipeline.Pipeline.score">
<code class="sig-name descname">score</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em>, <em class="sig-param">y=None</em>, <em class="sig-param">sample_weight=None</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/utils/metaestimators.py#L589"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.pipeline.Pipeline.score" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply transforms, and score with the final estimator</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">iterable</span></dt><dd><p>Data to predict on. Must fulfill input requirements of first step
of the pipeline.</p>
</dd>
<dt><strong>y</strong><span class="classifier">iterable, default=None</span></dt><dd><p>Targets used for scoring. Must fulfill label requirements for all
steps of the pipeline.</p>
</dd>
<dt><strong>sample_weight</strong><span class="classifier">array-like, default=None</span></dt><dd><p>If not None, this argument is passed as <code class="docutils literal notranslate"><span class="pre">sample_weight</span></code> keyword
argument to the <code class="docutils literal notranslate"><span class="pre">score</span></code> method of the final estimator.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>score</strong><span class="classifier">float</span></dt><dd></dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.pipeline.Pipeline.score_samples">
<code class="sig-name descname">score_samples</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/utils/metaestimators.py#L491"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.pipeline.Pipeline.score_samples" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply transforms, and score_samples of the final estimator.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">iterable</span></dt><dd><p>Data to predict on. Must fulfill input requirements of first step
of the pipeline.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>y_score</strong><span class="classifier">ndarray, shape (n_samples,)</span></dt><dd></dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.pipeline.Pipeline.set_params">
<code class="sig-name descname">set_params</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/pipeline.py#L152"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.pipeline.Pipeline.set_params" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the parameters of this estimator.</p>
<p>Valid parameter keys can be listed with <code class="docutils literal notranslate"><span class="pre">get_params()</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><dl class="simple">
<dt>self</dt><dd></dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.pipeline.Pipeline.transform">
<em class="property">property </em><code class="sig-name descname">transform</code><a class="headerlink" href="#sklearn.pipeline.Pipeline.transform" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply transforms, and transform with the final estimator</p>
<p>This also works where final estimator is <code class="docutils literal notranslate"><span class="pre">None</span></code>: all prior
transformations are applied.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">iterable</span></dt><dd><p>Data to transform. Must fulfill input requirements of first step
of the pipeline.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>Xt</strong><span class="classifier">array-like of shape  (n_samples, n_transformed_features)</span></dt><dd></dd>
</dl>
</dd>
</dl>
</dd></dl>

</dd></dl>

<div class="section" id="examples-using-sklearn-pipeline-pipeline">
<h2>Examples using <code class="docutils literal notranslate"><span class="pre">sklearn.pipeline.Pipeline</span></code><a class="headerlink" href="#examples-using-sklearn-pipeline-pipeline" title="Permalink to this headline">¶</a></h2>
<div class="sphx-glr-thumbcontainer" tooltip="An example illustrating the approximation of the feature map of an RBF kernel."><div class="figure align-default" id="id1">
<img alt="../../_images/sphx_glr_plot_kernel_approximation_thumb.png" src="../../_images/sphx_glr_plot_kernel_approximation_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/plot_kernel_approximation.html#sphx-glr-auto-examples-plot-kernel-approximation-py"><span class="std std-ref">Explicit feature map approximation for RBF kernels</span></a></span><a class="headerlink" href="#id1" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example compares 2 dimensionality reduction strategies:"><div class="figure align-default" id="id2">
<img alt="../../_images/sphx_glr_plot_feature_agglomeration_vs_univariate_selection_thumb.png" src="../../_images/sphx_glr_plot_feature_agglomeration_vs_univariate_selection_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/cluster/plot_feature_agglomeration_vs_univariate_selection.html#sphx-glr-auto-examples-cluster-plot-feature-agglomeration-vs-univariate-selection-py"><span class="std std-ref">Feature agglomeration vs. univariate selection</span></a></span><a class="headerlink" href="#id2" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="In this example, we will compare the impurity-based feature importance of RandomForestClassifie..."><div class="figure align-default" id="id3">
<img alt="../../_images/sphx_glr_plot_permutation_importance_thumb.png" src="../../_images/sphx_glr_plot_permutation_importance_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/inspection/plot_permutation_importance.html#sphx-glr-auto-examples-inspection-plot-permutation-importance-py"><span class="std std-ref">Permutation Importance vs Random Forest Feature Importance (MDI)</span></a></span><a class="headerlink" href="#id3" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates the problems of underfitting and overfitting and how we can use linea..."><div class="figure align-default" id="id4">
<img alt="../../_images/sphx_glr_plot_underfitting_overfitting_thumb.png" src="../../_images/sphx_glr_plot_underfitting_overfitting_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/model_selection/plot_underfitting_overfitting.html#sphx-glr-auto-examples-model-selection-plot-underfitting-overfitting-py"><span class="std std-ref">Underfitting vs. Overfitting</span></a></span><a class="headerlink" href="#id4" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="The dataset used in this example is the 20 newsgroups dataset which will be automatically downl..."><div class="figure align-default" id="id5">
<img alt="../../_images/sphx_glr_grid_search_text_feature_extraction_thumb.png" src="../../_images/sphx_glr_grid_search_text_feature_extraction_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/model_selection/grid_search_text_feature_extraction.html#sphx-glr-auto-examples-model-selection-grid-search-text-feature-extraction-py"><span class="std std-ref">Sample pipeline for text feature extraction and evaluation</span></a></span><a class="headerlink" href="#id5" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example balances model complexity and cross-validated score by finding a decent accuracy w..."><div class="figure align-default" id="id6">
<img alt="../../_images/sphx_glr_plot_grid_search_refit_callable_thumb.png" src="../../_images/sphx_glr_plot_grid_search_refit_callable_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/model_selection/plot_grid_search_refit_callable.html#sphx-glr-auto-examples-model-selection-plot-grid-search-refit-callable-py"><span class="std std-ref">Balance model complexity and cross-validated score</span></a></span><a class="headerlink" href="#id6" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This examples demonstrates how to precompute the k nearest neighbors before using them in KNeig..."><div class="figure align-default" id="id7">
<img alt="../../_images/sphx_glr_plot_caching_nearest_neighbors_thumb.png" src="../../_images/sphx_glr_plot_caching_nearest_neighbors_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/neighbors/plot_caching_nearest_neighbors.html#sphx-glr-auto-examples-neighbors-plot-caching-nearest-neighbors-py"><span class="std std-ref">Caching nearest neighbors</span></a></span><a class="headerlink" href="#id7" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="An example comparing nearest neighbors classification with and without Neighborhood Components ..."><div class="figure align-default" id="id8">
<img alt="../../_images/sphx_glr_plot_nca_classification_thumb.png" src="../../_images/sphx_glr_plot_nca_classification_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/neighbors/plot_nca_classification.html#sphx-glr-auto-examples-neighbors-plot-nca-classification-py"><span class="std std-ref">Comparing Nearest Neighbors with and without Neighborhood Components Analysis</span></a></span><a class="headerlink" href="#id8" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="For greyscale image data where pixel values can be interpreted as degrees of blackness on a whi..."><div class="figure align-default" id="id9">
<img alt="../../_images/sphx_glr_plot_rbm_logistic_classification_thumb.png" src="../../_images/sphx_glr_plot_rbm_logistic_classification_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/neural_networks/plot_rbm_logistic_classification.html#sphx-glr-auto-examples-neural-networks-plot-rbm-logistic-classification-py"><span class="std std-ref">Restricted Boltzmann Machine features for digit classification</span></a></span><a class="headerlink" href="#id9" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="In many real-world examples, there are many ways to extract features from a dataset. Often it i..."><div class="figure align-default" id="id10">
<img alt="../../_images/sphx_glr_plot_feature_union_thumb.png" src="../../_images/sphx_glr_plot_feature_union_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/compose/plot_feature_union.html#sphx-glr-auto-examples-compose-plot-feature-union-py"><span class="std std-ref">Concatenating multiple feature extraction methods</span></a></span><a class="headerlink" href="#id10" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="The PCA does an unsupervised dimensionality reduction, while the logistic regression does the p..."><div class="figure align-default" id="id11">
<img alt="../../_images/sphx_glr_plot_digits_pipe_thumb.png" src="../../_images/sphx_glr_plot_digits_pipe_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/compose/plot_digits_pipe.html#sphx-glr-auto-examples-compose-plot-digits-pipe-py"><span class="std std-ref">Pipelining: chaining a PCA and a logistic regression</span></a></span><a class="headerlink" href="#id11" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example illustrates how to apply different preprocessing and feature extraction pipelines ..."><div class="figure align-default" id="id12">
<img alt="../../_images/sphx_glr_plot_column_transformer_mixed_types_thumb.png" src="../../_images/sphx_glr_plot_column_transformer_mixed_types_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/compose/plot_column_transformer_mixed_types.html#sphx-glr-auto-examples-compose-plot-column-transformer-mixed-types-py"><span class="std std-ref">Column Transformer with Mixed Types</span></a></span><a class="headerlink" href="#id12" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example constructs a pipeline that does dimensionality reduction followed by prediction wi..."><div class="figure align-default" id="id13">
<img alt="../../_images/sphx_glr_plot_compare_reduction_thumb.png" src="../../_images/sphx_glr_plot_compare_reduction_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/compose/plot_compare_reduction.html#sphx-glr-auto-examples-compose-plot-compare-reduction-py"><span class="std std-ref">Selecting dimensionality reduction with Pipeline and GridSearchCV</span></a></span><a class="headerlink" href="#id13" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Datasets can often contain components of that require different feature extraction and processi..."><div class="figure align-default" id="id14">
<img alt="../../_images/sphx_glr_plot_column_transformer_thumb.png" src="../../_images/sphx_glr_plot_column_transformer_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/compose/plot_column_transformer.html#sphx-glr-auto-examples-compose-plot-column-transformer-py"><span class="std std-ref">Column Transformer with Heterogeneous Data Sources</span></a></span><a class="headerlink" href="#id14" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example shows how to perform univariate feature selection before running a SVC (support ve..."><div class="figure align-default" id="id15">
<img alt="../../_images/sphx_glr_plot_svm_anova_thumb.png" src="../../_images/sphx_glr_plot_svm_anova_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/svm/plot_svm_anova.html#sphx-glr-auto-examples-svm-plot-svm-anova-py"><span class="std std-ref">SVM-Anova: SVM with univariate feature selection</span></a></span><a class="headerlink" href="#id15" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This is an example showing how scikit-learn can be used to classify documents by topics using a..."><div class="figure align-default" id="id16">
<img alt="../../_images/sphx_glr_plot_document_classification_20newsgroups_thumb.png" src="../../_images/sphx_glr_plot_document_classification_20newsgroups_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/text/plot_document_classification_20newsgroups.html#sphx-glr-auto-examples-text-plot-document-classification-20newsgroups-py"><span class="std std-ref">Classification of text documents using sparse features</span></a></span><a class="headerlink" href="#id16" title="Permalink to this image">¶</a></p>
</div>
</div><div class="clearer"></div></div>
</div>


      </div>
    <div class="container">
      <footer class="sk-content-footer">
            &copy; 2007 - 2019, scikit-learn developers (BSD License).
          <a href="../../_sources/modules/generated/sklearn.pipeline.Pipeline.rst.txt" rel="nofollow">Show this page source</a>
      </footer>
    </div>
  </div>
</div>
<script src="../../_static/js/vendor/bootstrap.min.js"></script>

<script>
    window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
    ga('create', 'UA-22606712-2', 'auto');
    ga('set', 'anonymizeIp', true);
    ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>


<script>
$(document).ready(function() {
    /* Add a [>>>] button on the top-right corner of code samples to hide
     * the >>> and ... prompts and the output and thus make the code
     * copyable. */
    var div = $('.highlight-python .highlight,' +
                '.highlight-python3 .highlight,' +
                '.highlight-pycon .highlight,' +
		'.highlight-default .highlight')
    var pre = div.find('pre');

    // get the styles from the current theme
    pre.parent().parent().css('position', 'relative');
    var hide_text = 'Hide prompts and outputs';
    var show_text = 'Show prompts and outputs';

    // create and add the button to all the code blocks that contain >>>
    div.each(function(index) {
        var jthis = $(this);
        if (jthis.find('.gp').length > 0) {
            var button = $('<span class="copybutton">&gt;&gt;&gt;</span>');
            button.attr('title', hide_text);
            button.data('hidden', 'false');
            jthis.prepend(button);
        }
        // tracebacks (.gt) contain bare text elements that need to be
        // wrapped in a span to work with .nextUntil() (see later)
        jthis.find('pre:has(.gt)').contents().filter(function() {
            return ((this.nodeType == 3) && (this.data.trim().length > 0));
        }).wrap('<span>');
    });

    // define the behavior of the button when it's clicked
    $('.copybutton').click(function(e){
        e.preventDefault();
        var button = $(this);
        if (button.data('hidden') === 'false') {
            // hide the code output
            button.parent().find('.go, .gp, .gt').hide();
            button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'hidden');
            button.css('text-decoration', 'line-through');
            button.attr('title', show_text);
            button.data('hidden', 'true');
        } else {
            // show the code output
            button.parent().find('.go, .gp, .gt').show();
            button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'visible');
            button.css('text-decoration', 'none');
            button.attr('title', hide_text);
            button.data('hidden', 'false');
        }
    });

	/*** Add permalink buttons next to glossary terms ***/
	$('dl.glossary > dt[id]').append(function() {
		return ('<a class="headerlink" href="#' +
			    this.getAttribute('id') +
			    '" title="Permalink to this term">¶</a>');
	});
  /*** Hide navbar when scrolling down ***/
  // Returns true when headerlink target matches hash in url
  (function() {
    hashTargetOnTop = function() {
        var hash = window.location.hash;
        if ( hash.length < 2 ) { return false; }

        var target = document.getElementById( hash.slice(1) );
        if ( target === null ) { return false; }

        var top = target.getBoundingClientRect().top;
        return (top < 2) && (top > -2);
    };

    // Hide navbar on load if hash target is on top
    var navBar = document.getElementById("navbar");
    var navBarToggler = document.getElementById("sk-navbar-toggler");
    var navBarHeightHidden = "-" + navBar.getBoundingClientRect().height + "px";
    var $window = $(window);

    hideNavBar = function() {
        navBar.style.top = navBarHeightHidden;
    };

    showNavBar = function() {
        navBar.style.top = "0";
    }

    if (hashTargetOnTop()) {
        hideNavBar()
    }

    var prevScrollpos = window.pageYOffset;
    hideOnScroll = function(lastScrollTop) {
        if (($window.width() < 768) && (navBarToggler.getAttribute("aria-expanded") === 'true')) {
            return;
        }
        if (lastScrollTop > 2 && (prevScrollpos <= lastScrollTop) || hashTargetOnTop()){
            hideNavBar()
        } else {
            showNavBar()
        }
        prevScrollpos = lastScrollTop;
    };

    /*** high preformance scroll event listener***/
    var raf = window.requestAnimationFrame ||
        window.webkitRequestAnimationFrame ||
        window.mozRequestAnimationFrame ||
        window.msRequestAnimationFrame ||
        window.oRequestAnimationFrame;
    var lastScrollTop = $window.scrollTop();

    if (raf) {
        loop();
    }

    function loop() {
        var scrollTop = $window.scrollTop();
        if (lastScrollTop === scrollTop) {
            raf(loop);
            return;
        } else {
            lastScrollTop = scrollTop;
            hideOnScroll(lastScrollTop);
            raf(loop);
        }
    }
  })();
});

</script>
    
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
    
</body>
</html>